#include "Epoll.hpp"
#include <unistd.h>
#include <vector>
#include <cstring>
#include <iostream>

int main()
{
   Epoll ep;
   std::vector<int> ready;
   ep.Add(0, EPOLLIN);
   while (true) { 
      if (ep.Wait(&ready))
      {
	 char buffer[64]; buffer[0] = 0;
      	 ssize_t n = read(0, buffer, sizeof(buffer) - 1);
      	 if (n < 0) { std::cerr << "main::read err..." << std::endl; }
      	 buffer[n] = 0;
      	 std::cout << "input: " << buffer;
	 break;
      }
      else {
	 std::cout << "timeout/err..." << std::endl;
      }
   }
   return 0;
}
